;(function($){
	$.fn.timesRoom_entity = function(opts){
		var el = this.el;
		var opt = {
            roomContainer : "roomContainer",//房间色块容器
            roomEntity : null,//房间色块实体
            roomRightEntity : null,//房间鼠标右键实体
			dataBack : function(){},
            closeBack : function(){},
		}
		var param = $.extend(opt,opts);
		var app = new App(el,param);
	}
	
	var App = function(el,param){
		this.el = el;
		this.param = param;
		this.init();
	}
	
	App.prototype = {
		bindEvent : function(){
			var el = this.el;
			var param = this.param;
			var t = this;
			
		},
		init : function(){
			var el = this.el;
			var param = this.param;
            var t = this;

            //初始房间色块
            this.initRoomEntity();

        },
        initRoomEntity : function(){
            var el = this.el;
            var param = this.param;
            var t  = this;
            //初始房间色块
            if(!$.isFunction($().timesRoom_room)){
                $.ajaxSetup({ async: false, cache: false });
                $.getScript("js/timesRoom/jquery.service.timesRoom_room.js");
                $.ajaxSetup({ async: true});
            }
            $("#"+param.roomContainer).timesRoom_room({
                roomContainer : param.roomContainer,
                entityBack : function(roomEntity){
                    param.roomEntity = roomEntity;
                    t.initRoomRightEntity();
                },
                dataBack : function(){

                },
                closeBack : function(){

                }
            })
        },
        initRoomRightEntity :function(){
            var el = this.el;
            var param = this.param;
            var t = this;

            //初始房间鼠标右键事件
            if(!$.isFunction($().timesRoom_right)){
                $.ajaxSetup({ async: false, cache: false });
                $.getScript("js/timesRoom/jquery.service.timesRoom_right.js");
                $.ajaxSetup({ async: true});
            }
            $("").timesRoom_right({
                entityBack : function(roomRightEntity){
                    param.roomRightEntity = roomRightEntity;
                },
                dataBack : function(){

                },
                closeBack : function(){

                }
            })

        }
	}
})(jQuery);